function [dat]=r_data(dataset,kind,parameter,cruise,year)
% ------------------------------------------------------
% -- Reading observations
%
% --- Datasets --- Kind --- Parameter ------------------
%    cruise        woce      T S NO3
%                  amt       T S CHL
%    mooring       bats      T S NO3 CHL PON DON PP
%    climato       woa05     T S NO3
%                  mld       MLD
%    satellite     seawifs   CHL or OWP
%                  eke       EKE
%                  sst       T
%                  pp        PP
%    floats
% ------------------------------------------------------
% G. Charria (02/2008)

% Control intputs ...
switch nargin
    case 5 
        if (strcmp(dataset,'cruise'))
            if (strcmp(kind,'woce'))
                if ((~strcmp(parameter,'T'))...
                        &  (~strcmp(parameter,'S'))...
                        &  (~strcmp(parameter,'NO3')))
                    disp('This parameter is not available')
                    dat=[];
                    return
                end                
            elseif (strcmp(kind,'amt'))
                if ((~strcmp(parameter,'T'))...
                        &  (~strcmp(parameter,'S'))...
                        &  (~strcmp(parameter,'CHL')))
                    disp('This parameter is not available')
                    dat=[];
                    return
                end                                
            else
                disp('This cruise is not implemented')
                dat=[];
                return  
            end                           
        elseif (strcmp(dataset,'mooring'))
            if (strcmp(kind,'bats'))
                if ((~strcmp(parameter,'T'))...
                        &  (~strcmp(parameter,'S'))...
                        &  (~strcmp(parameter,'NO3'))...
                        &  (~strcmp(parameter,'CHL'))...
                        &  (~strcmp(parameter,'PON'))...
                        &  (~strcmp(parameter,'DON'))...
                        &  (~strcmp(parameter,'PP')))
                    disp('This parameter is not available')
                    dat=[];
                    return
                end                                                                
            else
                disp('This mooring is not implemented')
                dat=[];
                return  
            end                           
        elseif (strcmp(dataset,'climato'))
            if (strcmp(kind,'woa05'))
                if ((~strcmp(parameter,'T'))...
                        &  (~strcmp(parameter,'S'))...
                        &  (~strcmp(parameter,'NO3')))
                    disp('This parameter is not available')
                    dat=[];
                    return
                end                                                
            elseif (strcmp(kind,'mld'))                                   
            else
                disp('This climatology is not implemented')
                dat=[];
                return  
            end                            
        elseif (strcmp(dataset,'satellite'))
            if (~strcmp(kind,'seawifs'))...                
                    & (~strcmp(kind,'eke'))...       
                    & (~strcmp(kind,'sst'))...
                    & (~strcmp(kind,'pp'))                                                            
                disp('These satellite data are not implemented')
                dat=[];
                return  
            end                    
        elseif (strcmp(dataset,'floats'))
            disp('This dataset is not implemented')
            dat=[];
            return
        end
    otherwise
        display('Wrong number of input arguments')
        dat=[];
        return
end

switch dataset
   case 'cruise'
       switch kind
           case 'woce'
               [dat]=r_woce(parameter,cruise);
           case 'amt'
               [dat]=r_amt(parameter,cruise);
       end
   case 'mooring'
       switch kind
           case 'bats'
               [dat]=r_bats(parameter);
       end       
   case 'climato'
       switch kind
           case 'woa05'
               [dat]=r_woa05(parameter);
           case 'mld'
               [dat]=r_mld;
       end       
   case 'satellite'
       switch kind
           case 'seawifs'
               [dat]=r_seawifs;
           case 'eke'
               [dat]=r_eke(year);
           case 'sst'
               disp('Almost ready ...')
               dat=[];
               return
               [dat]=r_sst;
           case 'pp'
               [dat]=r_pp;
       end       
      
end


